#!/bin/sh
### BEGIN INIT INFO
# Provides:          aria2
# Required-Start:    $remote_fs $network
# Required-Stop:     $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Aria2 Downloader
### END INIT INFO
 
case "$1" in
start)
 
echo -n "Starting aria2c"
sudo -u root bash /root/.aria2/updatetracker.sh
sudo -u root aria2c --conf-path=/root/.aria2/aria2.conf -D
echo "aria2 actived."
;;
stop)
 
echo -n "Shutting down aria2c "
killall aria2c
echo "aria2 stoped."
;;
restart)
 
killall aria2c
sudo -u root aria2c --conf-path=/root/.aria2/aria2.conf -D
echo "aria2 restarted."
sudo -u root bash /root/.aria2/updatetracker.sh
;;
esac
exit
